.class final Lcom/greystripe/sdk/af;
.super Landroid/webkit/WebViewClient;


# instance fields
.field final synthetic a:Lcom/greystripe/sdk/aa;

.field private b:Lcom/greystripe/sdk/GSAdErrorCode;

.field private c:Z

.field private d:Z


# direct methods
.method private constructor <init>(Lcom/greystripe/sdk/aa;)V
    .locals 2

    const/4 v1, 0x0

    iput-object p1, p0, Lcom/greystripe/sdk/af;->a:Lcom/greystripe/sdk/aa;

    invoke-direct {p0}, Landroid/webkit/WebViewClient;-><init>()V

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/greystripe/sdk/af;->b:Lcom/greystripe/sdk/GSAdErrorCode;

    iput-boolean v1, p0, Lcom/greystripe/sdk/af;->c:Z

    iput-boolean v1, p0, Lcom/greystripe/sdk/af;->d:Z

    return-void
.end method

.method synthetic constructor <init>(Lcom/greystripe/sdk/aa;B)V
    .locals 0

    invoke-direct {p0, p1}, Lcom/greystripe/sdk/af;-><init>(Lcom/greystripe/sdk/aa;)V

    return-void
.end method


# virtual methods
.method public final onLoadResource(Landroid/webkit/WebView;Ljava/lang/String;)V
    .locals 2

    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "onLoadResource(): "

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/greystripe/sdk/bd;->b(Ljava/lang/String;[Ljava/lang/Object;)V

    iget-object v0, p0, Lcom/greystripe/sdk/af;->a:Lcom/greystripe/sdk/aa;

    invoke-static {v0}, Lcom/greystripe/sdk/aa;->f(Lcom/greystripe/sdk/aa;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/greystripe/sdk/af;->c:Z

    :cond_0
    return-void
.end method

.method public final onPageFinished(Landroid/webkit/WebView;Ljava/lang/String;)V
    .locals 3

    const/4 v2, 0x0

    const-string v0, "onPageFinished()"

    new-array v1, v2, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/greystripe/sdk/bd;->b(Ljava/lang/String;[Ljava/lang/Object;)V

    iput-boolean v2, p0, Lcom/greystripe/sdk/af;->d:Z

    iget-object v0, p0, Lcom/greystripe/sdk/af;->a:Lcom/greystripe/sdk/aa;

    invoke-virtual {v0}, Lcom/greystripe/sdk/aa;->a()V

    iget-object v0, p0, Lcom/greystripe/sdk/af;->a:Lcom/greystripe/sdk/aa;

    invoke-static {v0}, Lcom/greystripe/sdk/aa;->d(Lcom/greystripe/sdk/aa;)V

    invoke-static {}, Landroid/webkit/CookieSyncManager;->getInstance()Landroid/webkit/CookieSyncManager;

    move-result-object v0

    invoke-virtual {v0}, Landroid/webkit/CookieSyncManager;->sync()V

    iget-object v0, p0, Lcom/greystripe/sdk/af;->a:Lcom/greystripe/sdk/aa;

    invoke-static {v0}, Lcom/greystripe/sdk/aa;->e(Lcom/greystripe/sdk/aa;)Z

    move-result v0

    if-eqz v0, :cond_0

    const-string v0, "Page finished loading, but ad timed out."

    new-array v1, v2, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/greystripe/sdk/bd;->b(Ljava/lang/String;[Ljava/lang/Object;)V

    :goto_0
    return-void

    :cond_0
    iget-object v0, p0, Lcom/greystripe/sdk/af;->b:Lcom/greystripe/sdk/GSAdErrorCode;

    if-nez v0, :cond_1

    iget-boolean v0, p0, Lcom/greystripe/sdk/af;->c:Z

    if-eqz v0, :cond_1

    const-string v0, "Page finished with no errors, and fetched at least one resource."

    new-array v1, v2, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/greystripe/sdk/bd;->b(Ljava/lang/String;[Ljava/lang/Object;)V

    :goto_1
    iget-object v0, p0, Lcom/greystripe/sdk/af;->a:Lcom/greystripe/sdk/aa;

    const-string v1, "if(typeof gsTimeout == \'undefined\') { var gsTimeout = -1; } if(typeof gsStatus != \'undefined\') { ResponseStatus.setResponseStatusAndTimeout(gsStatus, gsTimeout); } else { ResponseStatus.setResponseStatusAndTimeout(-1, gsTimeout); }"

    invoke-virtual {v0, v1}, Lcom/greystripe/sdk/aa;->b(Ljava/lang/String;)V

    goto :goto_0

    :cond_1
    iget-object v0, p0, Lcom/greystripe/sdk/af;->b:Lcom/greystripe/sdk/GSAdErrorCode;

    if-nez v0, :cond_2

    const-string v0, "Page finished with no errors, but fetched no resources. Ad may be 100% embedded Javscript?"

    new-array v1, v2, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/greystripe/sdk/bd;->b(Ljava/lang/String;[Ljava/lang/Object;)V

    goto :goto_1

    :cond_2
    const-string v0, "Page finished with an error."

    new-array v1, v2, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/greystripe/sdk/bd;->b(Ljava/lang/String;[Ljava/lang/Object;)V

    iget-object v0, p0, Lcom/greystripe/sdk/af;->a:Lcom/greystripe/sdk/aa;

    invoke-static {v0}, Lcom/greystripe/sdk/aa;->a(Lcom/greystripe/sdk/aa;)Lcom/greystripe/sdk/ag;

    move-result-object v0

    iget-object v1, p0, Lcom/greystripe/sdk/af;->b:Lcom/greystripe/sdk/GSAdErrorCode;

    invoke-interface {v0, v1}, Lcom/greystripe/sdk/ag;->a(Lcom/greystripe/sdk/GSAdErrorCode;)V

    goto :goto_1
.end method

.method public final onPageStarted(Landroid/webkit/WebView;Ljava/lang/String;Landroid/graphics/Bitmap;)V
    .locals 2

    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "Page started: "

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {p1}, Landroid/webkit/WebView;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/greystripe/sdk/bd;->b(Ljava/lang/String;[Ljava/lang/Object;)V

    iget-object v0, p0, Lcom/greystripe/sdk/af;->a:Lcom/greystripe/sdk/aa;

    invoke-static {v0}, Lcom/greystripe/sdk/aa;->c(Lcom/greystripe/sdk/aa;)V

    iget-boolean v0, p0, Lcom/greystripe/sdk/af;->d:Z

    if-nez v0, :cond_0

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/greystripe/sdk/af;->d:Z

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/greystripe/sdk/af;->b:Lcom/greystripe/sdk/GSAdErrorCode;

    :cond_0
    return-void
.end method

.method public final onReceivedError(Landroid/webkit/WebView;ILjava/lang/String;Ljava/lang/String;)V
    .locals 3

    const/4 v2, 0x0

    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "ERROR: "

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " on url "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    new-array v1, v2, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/greystripe/sdk/bd;->e(Ljava/lang/String;[Ljava/lang/Object;)V

    sget-object v0, Lcom/greystripe/sdk/GSAdErrorCode;->SERVER_ERROR:Lcom/greystripe/sdk/GSAdErrorCode;

    iput-object v0, p0, Lcom/greystripe/sdk/af;->b:Lcom/greystripe/sdk/GSAdErrorCode;

    :try_start_0
    invoke-virtual {p1}, Landroid/webkit/WebView;->stopLoading()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    :try_start_1
    invoke-virtual {p1}, Landroid/webkit/WebView;->clearView()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    :goto_1
    iput-boolean v2, p0, Lcom/greystripe/sdk/af;->c:Z

    return-void

    :catch_0
    move-exception v0

    goto :goto_0

    :catch_1
    move-exception v0

    goto :goto_1
.end method

.method public final shouldOverrideUrlLoading(Landroid/webkit/WebView;Ljava/lang/String;)Z
    .locals 1

    const/4 v0, 0x1

    return v0
.end method
